package Class.Advance.MethodReference.Practise.ComprehensivePractise;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class StudentName2Array {
    public static void main(String[] args) {
        List<Student> studentList = new ArrayList<>();
        Collections.addAll(studentList,
                new Student("Jack", 20),
                new Student("Nick", 24),
                new Student("Black", 18)
        );
        String[] nameList = studentList.stream()
                .map(Student::getName)
                .toArray(String[]::new);
        for (String name : nameList) {
            System.out.println(name);
        }
    }
}
